package com.rd.p2p.mobile.user;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.UserService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.dto.User;
import com.qdlc.p2p.dal.model.UserModel;

/**
 * 安全中心
 *
 * @author wuhuan
 */
public class MobileSecurityAction extends BaseAction<UserModel> implements ModelDriven<UserModel> {
	@Resource
	private UserService userService;

	@Action(value = "/mobile/usercenter/security/setting", results = {
			@Result(name = "setting", type = "ftl", location = "/mobile/member/security/setting.html") })
	public String setting() throws Exception {
		return "setting";
	}

	/**
	 * 修改登录密码
	 *
	 * @return
	 * @throws Exception
	 */
	@Action(value = "/mobile/usercenter/security/modifyPwd", results = {
			@Result(name = "modifyPwd", type = "ftl", location = "/mobile/member/security/modifyPwd.html") })
	public String modifyPwd() throws Exception {
		return "modifyPwd";
	}

	/**
	 * 修改交易密码
	 *
	 * @return
	 * @throws Exception
	 */
	@Action(value = "/mobile/usercenter/security/modifyPaypwd", results = {
			@Result(name = "modifyPaypwd", type = "ftl", location = "/mobile/member/security/modifyPaypwd.html") })
	public String modifyPaypwd() throws Exception {
		User user = userService.getUserById(getSessionUserId());
		request.setAttribute("payPwd", user.getPayPwd());
		return "modifyPaypwd";
	}
	
	/**
	 * 忘记交易密码页面
	 *
	 * @return
	 * @throws Exception
	 */
	@Action(value = "/mobile/usercenter/security/forgetPaypwd", results = {
			@Result(name = "forgetPaypwd", type = "ftl", location = "/mobile/member/security/forgetPaypwd.html") })
	public String forgetPaypwd() throws Exception {
		return "forgetPaypwd";
	}
}
